package com.zhu.service;

import com.zhu.mapper.StockMapper;
import com.zhu.pojo.Stock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StockService {
    @Autowired
    private StockMapper stockMapper;

    public boolean addstock(Stock s){
        Stock ss = stockMapper.search(s.getModel());
        if(ss==null){
            stockMapper.addstock(s);
            return true;
        }
        return false;
    }

    public List<Stock> search(String model){
        return stockMapper.searchh(model);
    }

    public void edit(Stock s){
        stockMapper.edit(s);
    }

    public Stock searchOne(String model){
        return stockMapper.search(model);
    }

    public void delete(String model){
        stockMapper.delete(model);
    }

    public List<String> areas(){return stockMapper.areas();}
}
